#!/usr/bin/env bash
# encoding: utf-8.0

ld_postgres="/lyndon/iSoft/postgres/lib"
ld_ivorysql="/lyndon/iSoft/IvorySQL/lib"

function joinByChar() {
  local IFS="$1"
  shift
  echo "$*"
}

function test_split_func()
{
  local params="$1"p
  #echo "params:${params}"
  IFS=:
  to_array=()
  i=0
  for dir in $params
  do
    if [ ${dir} == ${ld_postgres} -o ${dir} == ${ld_ivorysql} ] 
    then
      continue
    fi
    to_array[$i]=${dir}
    i+=1
  done

  to_array[$i]=${ld_postgres}

  echo ${to_array[*]}
}

function split_join() {
  local ld_path="$1"
  local ss="$2"
  echo "ss:${ss}"
  result=($(test_split_func ${ld_path}))
  echo $(joinByChar ':' ${result[@]})
}

RE_LD=$(split_join ${LD_LIBRARY_PATH} "1234")

echo "funcTreturn: ${RE_LD}"


